package com.springcloud.auth.authentication.provider;

import com.springcloud.auth.authentication.provider.fallback.ResourceProviderFallBack;
import com.springcloud.common.core.entity.R;
import com.springcloud.common.entity.Resource;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Set;

/**
 * 资源接口
 * @author mori
 */
@FeignClient(name = "system-user-service",fallback = ResourceProviderFallBack.class)
public interface ResourceProvider {

    /**
     * 加载所有的资源
     * @return
     */
    @GetMapping(value = "/resource/all")
    R<Set<Resource>> resources();

    /**
     * 根据username加载对应的资源
     * @param username
     * @return
     */
    @GetMapping(value = "/resource/user")
    R<Set<Resource>> resources(@RequestParam("username") String username);
}
